package com.wlz.ota.util;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 自定义异常
 * </p>
 *
 * @author liqi
 * @since 2020-09-15
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class BusinessException extends RuntimeException {

    private final Integer code;
    private final String message;

    public BusinessException() {
        this(ResponseEnum.ERROR);
    }

    public BusinessException(String message) {
        this.code = ResponseEnum.ERROR.getCode();
        this.message = message;
    }

    public BusinessException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public BusinessException(ResponseEnum re) {
        this.code = re.getCode();
        this.message = re.getMessage();
    }
}
